﻿#include "fish.h"

fish::fish(const QString&path,QGraphicsScene*scene):pixmapItem(path,scene)
{
    setPos(mapToScene(-qrand()%300,qrand()%400+100));
}

void fish::advance(int phase)
{
    if(mapToScene(0,0).x()>scene()->width()||mapToScene(0,0).y()<0)
    {
        setPos(-qrand()%300,qrand()%400+100);
    }
    setPos(mapToScene(qrand()%5+1,-.3));//往右上角移动
}

